package com.qf.stub;

import com.qf.pojo.Order;
import com.qf.service.OrderService;

import java.util.List;

public class OrderServiceStub implements OrderService {

    private OrderService orderService;

    //通过构造方法，将真正的远程对象传递过来
    public OrderServiceStub(OrderService orderService) {
        this.orderService = orderService;
    }

    @Override
    public List<Order> findByUid(Integer uid) throws InterruptedException {

        //在发起远程调用之前，对参数执行校验
        if (uid > 1000){
            throw new RuntimeException("该id不存在。。。");
        }


        return orderService.findByUid(uid);
    }
}
